import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  FlatList
} from 'react-native';

const util = require("./common/util.js");
export default class flatList extends Component {
  constructor(props) {
    super(props);
  }
  componentDidMount() {
    util.request({
      url: "/eat/list", 
      body:{typeId:1},
      succes: function(result){
        console.log(result);
      },
      fail: function(error){
        console.log(error);
      }
    });
  }
  render() {
    return (
       <View class={styles.container}>
           <FlatList
            data={[
                {key: "北京"},
                {key: "上海"},
                {key: "武汉"},
                {key: "南京"},
                {key: "福建"},
                {key: "杭州"},
                {key: "西安"},
                {key: "苏州"},
                {key: "宁波"},
                {key: "郑州"},
                {key: "开封"},
                {key: "天津"},
                {key: "重庆"},
                {key: "哈尔滨"},
                {key: "沈阳"},
                {key: "长春"},
                {key: "青岛"},
                {key: "大连"}
              ]}
            renderItem={({item})=> <Text style={styles.item}>{item.key}</Text>}
           >
           </FlatList>
       </View>
    );
  }
}

const styles = StyleSheet.create({
    container:{
      paddingTop: 22,
      flex: 1
    },
    item: {
      padding: 10,
      fontSize: 18,
      height: 44
    }
});

module.exports = flatList;
